package service;

import entity.Cart;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * @version 1.0
 * @Author: xxf
 * @CreateDate: 2020/10/6 18:37
 */
public interface CartService {

    /**
     * 添加商品到购物车
     * @param pid
     * @param uid
     */
    void addCart(int pid, int uid) throws InvocationTargetException, IllegalAccessException;

    /**
     * 查询购物车中的商品
     * @param uid 根据uid查询该用户购物车
     * @return
     */
    List<Cart> findAll(int uid) throws InvocationTargetException, IllegalAccessException;

    /**
     * 删除购物车中单条数据
     * @param cid
     */
    void delCartByCid(int cid);

    /**
     * 修改购物车中的单条数据
     * @param cid
     * @param cnum
     * @param price
     */
    void updateCart(int cid, int cnum, int price);

    /**
     * 清空购物车
     * @param uid
     */
    void clearCart(int uid);
}
